﻿using System;

namespace HslCommunication.Profinet.Keyence
{
	/// <summary>
	/// Keyence PLC的数据类型，此处包含了几个常用的类型
	/// </summary>
	// Token: 0x0200008A RID: 138
	public class KeyenceDataType
	{
		/// <summary>
		/// 如果您清楚类型代号，可以根据值进行扩展
		/// </summary>
		/// <param name="code">数据类型的代号</param>
		/// <param name="type">0或1，默认为0</param>
		/// <param name="asciiCode">ASCII格式的类型信息</param>
		/// <param name="fromBase">指示地址的多少进制的，10或是16</param>
		// Token: 0x06000AC2 RID: 2754 RVA: 0x0004033C File Offset: 0x0003E53C
		public KeyenceDataType(byte code, byte type, string asciiCode, int fromBase)
		{
			this.DataCode = code;
			this.AsciiCode = asciiCode;
			this.FromBase = fromBase;
			bool flag = type < 2;
			if (flag)
			{
				this.DataType = type;
			}
		}

		/// <summary>
		/// 类型的代号值
		/// </summary>
		// Token: 0x170001BF RID: 447
		// (get) Token: 0x06000AC3 RID: 2755 RVA: 0x00040388 File Offset: 0x0003E588
		// (set) Token: 0x06000AC4 RID: 2756 RVA: 0x00040390 File Offset: 0x0003E590
		public byte DataCode { get; private set; } = 0;

		/// <summary>
		/// 数据的类型，0代表按字，1代表按位
		/// </summary>
		// Token: 0x170001C0 RID: 448
		// (get) Token: 0x06000AC5 RID: 2757 RVA: 0x00040399 File Offset: 0x0003E599
		// (set) Token: 0x06000AC6 RID: 2758 RVA: 0x000403A1 File Offset: 0x0003E5A1
		public byte DataType { get; private set; } = 0;

		/// <summary>
		/// 当以ASCII格式通讯时的类型描述
		/// </summary>
		// Token: 0x170001C1 RID: 449
		// (get) Token: 0x06000AC7 RID: 2759 RVA: 0x000403AA File Offset: 0x0003E5AA
		// (set) Token: 0x06000AC8 RID: 2760 RVA: 0x000403B2 File Offset: 0x0003E5B2
		public string AsciiCode { get; private set; }

		/// <summary>
		/// 指示地址是10进制，还是16进制的
		/// </summary>
		// Token: 0x170001C2 RID: 450
		// (get) Token: 0x06000AC9 RID: 2761 RVA: 0x000403BB File Offset: 0x0003E5BB
		// (set) Token: 0x06000ACA RID: 2762 RVA: 0x000403C3 File Offset: 0x0003E5C3
		public int FromBase { get; private set; }

		/// <summary>
		/// X输入继电器
		/// </summary>
		// Token: 0x04000313 RID: 787
		public static readonly KeyenceDataType X = new KeyenceDataType(156, 1, "X*", 16);

		/// <summary>
		/// Y输出继电器
		/// </summary>
		// Token: 0x04000314 RID: 788
		public static readonly KeyenceDataType Y = new KeyenceDataType(157, 1, "Y*", 16);

		/// <summary>
		/// 链接继电器
		/// </summary>
		// Token: 0x04000315 RID: 789
		public static readonly KeyenceDataType B = new KeyenceDataType(160, 1, "B*", 16);

		/// <summary>
		/// 内部辅助继电器
		/// </summary>
		// Token: 0x04000316 RID: 790
		public static readonly KeyenceDataType M = new KeyenceDataType(144, 1, "M*", 10);

		/// <summary>
		/// 锁存继电器
		/// </summary>
		// Token: 0x04000317 RID: 791
		public static readonly KeyenceDataType L = new KeyenceDataType(146, 1, "L*", 10);

		/// <summary>
		/// 控制继电器
		/// </summary>
		// Token: 0x04000318 RID: 792
		public static readonly KeyenceDataType SM = new KeyenceDataType(145, 1, "SM", 10);

		/// <summary>
		/// 控制存储器
		/// </summary>
		// Token: 0x04000319 RID: 793
		public static readonly KeyenceDataType SD = new KeyenceDataType(169, 0, "SD", 10);

		/// <summary>
		/// 数据存储器
		/// </summary>
		// Token: 0x0400031A RID: 794
		public static readonly KeyenceDataType D = new KeyenceDataType(168, 0, "D*", 10);

		/// <summary>
		/// 文件寄存器
		/// </summary>
		// Token: 0x0400031B RID: 795
		public static readonly KeyenceDataType R = new KeyenceDataType(175, 0, "R*", 10);

		/// <summary>
		/// 文件寄存器
		/// </summary>
		// Token: 0x0400031C RID: 796
		public static readonly KeyenceDataType ZR = new KeyenceDataType(176, 0, "ZR", 16);

		/// <summary>
		/// 链路寄存器
		/// </summary>
		// Token: 0x0400031D RID: 797
		public static readonly KeyenceDataType W = new KeyenceDataType(180, 0, "W*", 16);

		/// <summary>
		/// 计时器（当前值）
		/// </summary>
		// Token: 0x0400031E RID: 798
		public static readonly KeyenceDataType TN = new KeyenceDataType(194, 0, "TN", 10);

		/// <summary>
		/// 计时器（接点）
		/// </summary>
		// Token: 0x0400031F RID: 799
		public static readonly KeyenceDataType TS = new KeyenceDataType(193, 1, "TS", 10);

		/// <summary>
		/// 计数器（当前值）
		/// </summary>
		// Token: 0x04000320 RID: 800
		public static readonly KeyenceDataType CN = new KeyenceDataType(197, 0, "CN", 10);

		/// <summary>
		/// 计数器（接点）
		/// </summary>
		// Token: 0x04000321 RID: 801
		public static readonly KeyenceDataType CS = new KeyenceDataType(196, 1, "CS", 10);
	}
}
